package huffmanTree;

/**
 * @author Aaron
 * @desc
 * @createTime 2021/12/10 20:51
 * @since
 */
public class HuffmanNode<T>  implements Comparable<HuffmanNode>{

    public HuffmanNode left, right;

    public long frequency;

    public int deep;

    public HuffmanNode(long freq) {
        frequency = freq;
    }

    public int compareTo(HuffmanNode tree) {
        return Long.compare(frequency, tree.frequency);
    }

    public HuffmanNode<T> setDeep(int deep){
        this.deep=deep;
        return this;
    }

    public HuffmanNode(HuffmanNode l, HuffmanNode r) {
        frequency = l.frequency + r.frequency;
        left = l;
        right = r;
    }
}
